/*
 * Powered By [pkuWx]
 * Web Site: http://www.wuxi.ss.pku.edu.cn
 * Since 2015 - 2015
 */

package cn.edu.pku.wxlib.usertobookborrow.dao;

import java.util.*;

import cn.edu.pku.wxlib.usertobookborrow.model.*;
import cn.edu.pku.wxlib.usertobookborrow.service.*;
import cn.edu.pku.wxlib.usertobookborrow.vo.query.*;
import cn.edu.pku.wxlib.vo.query.BookBorrowFullQuery;
import cn.edu.pku.wxlib.vo.response.BookBorrowFull;
import javacommon.base.*;
import javacommon.util.*;
import javacommon.page.Page;

/**
 * @version 1.0
 * @since 1.0
 */


import org.springframework.stereotype.Repository;


@Repository
public class UsertobookborrowDao extends BaseIbatis3Dao<Usertobookborrow,UsertobookborrowQuery,java.lang.Integer>{
	
	@Override
	public String getIbatisMapperNamesapce() {
		return "Usertobookborrow";
	}
	
	public void saveOrUpdate(Usertobookborrow entity) {
		if(entity.getUserToBookBorrowId() == null) 
			save(entity);
		else 
			update(entity);
	}
	
	public Page findPage(UsertobookborrowQuery query) {
		return pageQuery("Usertobookborrow.findPage",query);
	}

	public Page findFull(BookBorrowFullQuery query) {
		return pageQuery("Usertobookborrow.findFullPage",query);
	}

	public List<Usertobookborrow> countByStates(BookBorrowFullQuery query) {
		return this.getSqlSessionTemplate().selectList("Usertobookborrow.countByStatus", query);
	}
	

}
